Skip to main content

Data Structure

Linear Data Structures

Data StructureCharacteristicsAdvantagesDisadvantages
ArrayFixed size, elements stored in contiguous memory locations.Fast access to elements by index.Fixed size, inefficient resizing.
Linked ListDynamic size, elements linked using pointers.Easy insertion and deletion.Slower access to elements due to sequential traversal.
StackLIFO (Last In First Out) structure, can be implemented using arrays or linked lists.Easy to implement; provides last-in, first-out access.Limited access flexibility (only top of stack accessible).
QueueFIFO (First In First Out) structure, can be implemented using arrays or linked lists.Ordered data management; ensures first-in, first-out access.Limited access flexibility (only front of queue accessible).

Non -Linear Data Structures

Data StructureCharacteristicsAdvantagesDisadvantages
TreeHierarchical structure with nodes connected by edges, no cycles, one root node.Reflects structural relationships, efficient search, insert, and delete.Can become unbalanced, leading to inefficient operations.
GraphConsists of vertices/nodes and edges, can be directed or undirected, may contain cycles.Highly flexible, represents complex relationships and networks.More complex algorithms required for traversing and searching.
HeapSpecialized tree-based structure that satisfies the heap property (e.g., min-heap or max-heap).Efficient for priority queue operations, good for quick access to max/min.Primarily used for priority queues, not for search operations.